<template>
	<div class="home">
		<!-- 轮播图 -->
		<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
			<van-swipe-item v-for="v in lbt_image" :key="v">
				<router-link
					tag="img"
					to="/home/water"
					:src="require('../assets/home_image/' + v)"
					alt=""
				/>
			</van-swipe-item>
		</van-swipe>
		<!-- 假二级导航 -->
		<div class="home_select_card">
			<van-grid :border="false">
				<van-grid-item
					:to="item.link"
					v-for="item in nav_image"
					:key="item.title"
				>
					<van-image :src="require('../assets/home_image/' + item.src)" />
					<p>{{ item.title }}</p>
				</van-grid-item>
			</van-grid>
		</div>
		<!-- 新闻切换 -->
		<div class="home_news">
			<van-notice-bar
				@click="fn_target"
				mode="link"
				background="white"
				color="#888"
				:scrollable="false"
				left-icon="volume-o"
				text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
			/>
		</div>
		<!-- 点击跳入产品详情 -->
		<!-- 精品推荐 -->
		<div class="home_Fine all_nav">
			<van-nav-bar :border="false">
				<template #left>
					<h3>精品推荐</h3>
				</template>
				<template #right>
					{{}}<span>/</span>{{ jingpin_image.length }}
				</template>
			</van-nav-bar>
			<div class="all_grid">
				<van-grid :column-num="4">
					<van-grid-item v-for="item in jingpin_image" :key="item.src">
						<router-link
							tag="img"
							:to="item.link"
							:src="require('../assets/home_image/' + item.src)"
						/>
					</van-grid-item>
				</van-grid>
			</div>
		</div>
		<!-- 酒水推荐 -->
		<div class="all_nav">
			<div class="home_jiushui">
				<van-nav-bar :border="false">
					<template #left>
						<h3>酒水推荐</h3>
					</template>
					<template #right>
						{{}}<span>/</span>{{ jingpin_image.length }}
					</template>
				</van-nav-bar>
				<div class="all_grid">
					<van-grid :column-num="4">
						<van-grid-item v-for="item in jingpin_image" :key="item.src">
							<div class="home_jiushui_con"></div>
							<router-link
								tag="img"
								:to="item.link"
								:src="require('../assets/home_image/' + item.src)"
							/>
							<router-link
								tag="img"
								:to="item.link"
								:src="require('../assets/home_image/' + item.src)"
							/>
						</van-grid-item>
					</van-grid>
				</div>
			</div>
		</div>
		<!-- 猜你喜欢 -->
		<div class="home_like">
			<van-nav-bar :border="false">
				<template #title>
					<h3>猜你喜欢</h3>
				</template>
			</van-nav-bar>
		</div>
		<ul class="home_like_product">
			<li v-for="item in like_product" :key="item.src">
				<img :src="require('../assets/home_image/' + item.src)" alt="" />
				<p>{{ item.info }}</p>
				<span>${{ item.money }}</span>
			</li>
		</ul>
		<!-- 查看更多 -->
		<div>
			<van-nav-bar>
				<template #title>
					<router-link to="/home/product">更多 > ></router-link>
				</template>
			</van-nav-bar>
		</div>
	</div>
</template>

<script>
export default {
	name: 'Home',
	components: {},
	data() {
		return {
			// 轮播图数据
			lbt_image: [
				'ia_100000002.jpg',
				'ia_100000003.jpg',
				'ia_100000004.jpg',
				'ia_100000005.jpg',
			],
			// 分类数据
			nav_image: [
				{
					title: '精选',
					link: '/home/product/zonghe',
					src: 'ia_100000006.png',
				},
				{
					title: '酒水',
					link: '/home/product/zonghe',
					src: 'ia_100000007.png',
				},
				{ title: '订单', link: '/home/indent', src: 'ia_100000008.png' },
				{ title: '商家入驻', link: '/home/merchant', src: 'ia_100000009.png' },
			],
			// 精品数据
			jingpin_image: [
				{ link: '/home/sift', src: 'ia_100000034.jpg' },
				{ link: '/home/water', src: 'ia_100000035.jpg' },
				{ link: '/home/indent', src: 'ia_100000037.jpg' },
				{ link: '/home/merchant', src: 'ia_100000038.jpg' },
				{ link: '/home/merchant', src: 'ia_100000039.jpg' },
				{ link: '/home/merchant', src: 'ia_100000041.jpg' },
			],
			// 猜你喜欢
			like_product: [
				{
					src: 'ia_100000042.jpg',
					link: '/home/product',
					info: '洋河蓝色瓶装经典Q7浓香型白酒500ml52度高端纯粮食白酒2瓶装包邮',
					money: 20,
				},
				{
					src: 'ia_100000043.jpg',
					link: '/home/product',
					info: '洋河蓝色瓶装经典Q7浓香型白酒500ml52度高端纯粮食白酒2瓶装包邮',
					money: 20,
				},
				{
					src: 'ia_100000044.jpg',
					link: '/home/product',
					info: '洋河蓝色瓶装经典Q7浓香型白酒500ml52度高端纯粮食白酒2瓶装包邮',
					money: 20,
				},
				{
					src: 'ia_100000045.jpg',
					link: '/home/product',
					info: '洋河蓝色瓶装经典Q7浓香型白酒500ml52度高端纯粮食白酒2瓶装包邮',
					money: 20,
				},
			],
		}
	},
	methods: {
		fn_target() {
			this.$router.push('/home/news')
		},
	},
}
</script>

<style lang="scss" scpoed>
.home_select_card img {
	width: 43px;
	border-radius: 50%;
}
.home_select_card p {
	font-size: 11px;
	color: #454545;
	margin-top: 5px;
}
.home_like h3 {
	position: relative;
}
.home_like h3:after {
	content: '';
	position: absolute;
	display: block;
	width: 30px;
	height: 3px;
	top: 50%;
	left: -50px;
	background: red;
	transform: translateX(-50%);
}
.home_like h3:before {
	content: '';
	position: absolute;
	display: block;
	width: 30px;
	height: 3px;
	top: 50%;
	right: -80px;
	background: red;
	transform: translateX(-50%);
}
.home_like_product {
	display: flex;
	flex-wrap: wrap;
}
.home_like_product .van-nav-bar {
	background: #eee;
}
.home_like_product li {
	background: white;
	width: 176px;
	height: 252px;
	margin-bottom: 2%;
	margin-left: 2%;
	img {
		width: 100%;
	}
	p {
		height: 38px;
		line-height: 19px;
		font-size: 12px;
		overflow: hidden;
	}
	span {
		color: red;
	}
}
</style>
<style >
.all_nav .van-nav-bar__left {
	position: relative;
}
.all_nav .van-nav-bar__left:after {
	content: '';
	height: 100%;
	width: 3px;
	background: red;
	position: absolute;
	top: 0;
	left: 0;
}
.all_nav .van-nav-bar {
	background: #eee;
}
.all_grid {
	overflow: hidden;
}
.all_grid .van-grid {
	height: 140px;
	margin: 0 0 -10px;
	flex-wrap: nowrap;
	overflow-x: auto;
}
.all_grid img {
	width: 123px;
}
.all_grid .van-grid-item__content {
	padding: 0;
}
.home_jiushui .van-grid {
	height: 280px;
}
.home_like .van-ellipsis {
	overflow: inherit;
}
</style>
